#ifndef __PID_
#define __PID_

#include "stm32f1xx_hal.h"
#include "stdint.h"

typedef struct 
{
	float error;
	float last_error;
	float target;
	float output;
	float vlim;
	float slim;
	
	float MaxIntel;
	float DeadBand;
	
	
	float kp;
	float ki;
	float kd;
	
	float pout;
	float iout;
	float dout;

	uint8_t distance;
}pid_para;
void pid_Init(float kkp,
							float kki,
							float kkd,
							float Deadb,
							float MaxIn,
							float vm,
							float sm,
							pid_para* pid_typedef);

void pid_calculate_v(pid_para* pid_typedef,float measure);
void reset_pid(float kkp,float kki,float kkd,pid_para* pid_typedef);		
void pid_calculate_s(pid_para* pid_typedef_s,pid_para* pid_typedef_v,float measure_s,float measure_v);							

							
extern pid_para para_v[];
extern pid_para para_s[];							

#endif








